Program:    AFACTOR
Author:     Rob Gaebler
Date:       1/13/01
Includes:   AFACTOR     40 bytes
            ZFACTOR     300 bytes
            ZASMLOAD    224 bytes


AFACTOR is a very fast assembly program for the TI-83 that
finds all the prime factors of a positive integer.  Run
program AFACTOR from the home screen, ASHELL, or SOS.  At
the prompt, enter a number.


Special features of AFACTOR include the following:

-->     The greatest feature is SPEED!  AFACTOR is more
        than 25 times faster than most factoring programs
        for the TI-82, TI-83, TI-83 Plus, TI-85, and TI-86.
        It is by far the fastest factoring program on any
        of these calculators (for now).  The closest rivals
        are ABIGSIV and PRIMEC for the TI-83; AFACTOR is
        more than twice as fast as either of them.  AFACTOR
        takes only 13 seconds to factor 99999989 (the
        largest 8-digit prime), while most programs take
        longer than 5 minutes!

-->     ASHELL/SOS compatible.  Can be run from ASHELL,
        SOS, or the home screen.

-->     Displays the factors as it finds them, in order
        from smallest to largest.  Displays a factor
        multiple times if a power greater than 1 is a
        factor.

-->     Displays percent done (supposing the number is
        prime) about three times per second.  

-->     Can be interrupted in the middle of factoring.
        Press Del to interrupt and exit.  Returns to ASHELL
        or SOS if you used one of them.

-->     Pauses after finding all the factors or quitting,
        so you can see them before returning to ASHELL or
        SOS (if you used one of them.)

-->     Accurately factors any number up to 20000000000000
        (that's 2*10^13).  Numbers greater than that may be
        factored incorrectly due to the limitations of the
        TI-83.

-->     Uses only the variable X, the number that you
        input.

-->     Handles bad input (not a positive integer)
        gracefully.  Quits instead of crashing your
        calculator.

-->     Has no known bugs.  Please email me if you find any
        bugs or have any ideas for improvement.  Even minor
        suggestions for improvement are welcome.


WARNING: If you run AFACTOR from SOS, DO NOT quit by
pressing [ON] or [2nd][QUIT] or [2nd][OFF] while AFACTOR
is prompting you for a number or pausing.  If you do,
several hundred bytes will leak from your calculator's
memory.  This is not a bug in AFACTOR, it is a problem
with SOS.  ASHELL does not have this flaw.


I have included the source code for ZFACTOR for the benefit
of programmers.  Please do not revise my program without
consulting me.  However, you may distribute it freely.


I am in the midst of making a much faster TI-83 assembly
factoring program called AFACTOR2.  It will be about 15
times faster than AFACTOR, but it will be much larger
(almost 2000 bytes).


Email me with questions, comments, or suggestions at
rgaebler@hmc.edu.